package com.inspur.edp.ai.flow.core.engine;

import com.inspur.edp.ai.flow.metadata.FlowMetadata;
import com.inspur.edp.common.expr.evaluator.ExpressEvaluator;

import java.util.Map;

/**
 * @author lizhaorui
 * @date 2025/9/4
 * @description
 */

public class FlowRTObjectLoader {

    public FlowRTObject load(FlowMetadata metadata) {
        FlowRTObject flowRTObject = new FlowRTObject();
        flowRTObject.setToolVersion("1.0");
        //1、设置元数据、版本
        flowRTObject.setFlow(metadata);
        flowRTObject.setVersion(metadata.getCacheVersion());
        //2、设置编译结果
        CompileEngine compileEngine = new CompileEngine();
        Map<String, Map<String, ExpressEvaluator>> inputParams = compileEngine.buildAllNodeParams(metadata);
        flowRTObject.setInputParamEvaluators(inputParams);
        return flowRTObject;
    }

}